
<template>
  <el-single-select
    :dataObj="supplierData.tableData"
    :prop="supplierData.tableHeadOptions"
    :pageSizeCode="supplierData.formDate.pageSize"
    :pageSizes="pageSizes"
    :total="supplierData.recordsTotal"
    @handleSizeChange="handleSizeChange"
    @handleCurrentChange="handleCurrentChange"
    @confirm="confirm"
    :dialogVisible.sync="dialogVisible"
    :title="supplierData.title"
  >
    <template slot="dialogTop">
      <div
        class="dialog-input"
        v-for="item in supplierData.tableHeadOptions"
        :key="item.prop"
      >
        <span class="label">{{ item.label }}：</span>
        <el-input
          :placeholder="`请输入${item.label}模糊查询`"
          v-model="supplierData.formDate[item.prop]"
          style="width: 260px"
          clearable
        />
      </div>
      <div style="width: 100%; display: flex; justify-content: center">
        <el-button
          size="mini"
          type="primary-font-mini"
          @click="singleSelectSearch"
          >搜索
        </el-button>
        <el-button size="mini" type="default-mini" @click="handleReset"
          >重置
        </el-button>
      </div>
    </template>
  </el-single-select>
</template>
<script>
export default {
  name: "chooseSupplier",
  data() {
    return {
      pageSizes: [10, 20, 50, 100, 500],
      dialogVisible: false
    };
  },
  props: {
    supplierData: {
      type: Object,
      default: () => {}
    }
  },
  methods: {
    confirm(val) {
      this.$emit("selectPartyB", { confirmSelect: val, status: "confirm" });
    },
    //搜索
    singleSelectSearch() {
      this.$emit("selectPartyB", {
        formDate: this.supplierData.formDate,
        status: "search"
      });
    },
    //重置
    handleReset() {
      this.$emit("selectPartyB", { status: "reset" });
    },
    // 招标结果关联弹窗 切换每页条数
    handleSizeChange(val) {
      this.supplierData.formDate.pageSize = val;
      this.$emit("selectPartyB", { pageSize: val, status: "pageSize" });
    },
    // 招标结果关联弹窗 切换页
    handleCurrentChange(val) {
      this.supplierData.formDate.pageNo = val;
      this.$emit("selectPartyB", { pageNo: val, status: "pageNo" });
    }
  }
};
</script>
<style lang="scss" scoped>
.chooseSettle {
  display: inline-block;
}
/deep/.el-single-select
  .el-dialog__wrapper
  .el-dialog
  .el-dialog__body
  .el-dialog-box
  .dialog-top {
  justify-content: space-between;
}
/deep/ .el-table__body-wrapper {
  max-height: 230px !important;
}
/deep/.label {
  display: inline-block;
  width: 130px !important;
  text-align: right;
}
/deep/ .el-dialog__footer {
  border-top: none;
}
// .el-single-select .el-dialog__wrapper .el-dialog {
//   height: 606px !important;
// }
</style>
